home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / tools / developer-tools / guis / iedit / developer / expanders / scroll / funcs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-10  |  20.5 KB  |  627 lines

  1. /***********************************************
  2. **                                            **
  3. **  ScrollerWindow.iex  ©1996 Simone Tellini  **
  4. **                       All Rights Reserved  **
  5. **                                            **
  6. **  Based on:                                 **
  7. **   scrollerwindow.c 0.3 by Christoph Feck   **
  8. **                                            **
  9. ***********************************************/
  10. /// Includes
  11. #define INTUI_V36_NAMES_ONLY
  12.  
  13. #include <exec/nodes.h>                 // exec
  14. #include <exec/lists.h>
  15. #include <exec/memory.h>
  16. #include <exec/types.h>
  17. #include <dos/dos.h>                    // dos
  18. #include <intuition/intuition.h>        // intuition
  19. #include <intuition/classusr.h>
  20. #include <intuition/imageclass.h>
  21. #include <intuition/icclass.h>
  22. #include <intuition/gadgetclass.h>
  23. #include <clib/exec_protos.h>           // protos
  24. #include <clib/dos_protos.h>
  25. #include <clib/intuition_protos.h>
  26. #include <pragmas/exec_pragmas.h>       // pragmas
  27. #include <pragmas/dos_pragmas.h>
  28. #include <pragmas/graphics_pragmas.h>
  29. #include <pragmas/intuition_pragmas.h>
  30.  
  31. #include <stdarg.h>
  32. #include <string.h>
  33. #include <stdio.h>
  34. #include <stdlib.h>
  35. #include <ctype.h>
  36.  
  37. #include "DEV_IE:Expanders/defs.h"
  38. ///
  39. /// Prototypes
  40. struct ObjInfo {
  41.         struct  Node    Node;
  42.         UWORD           Kind;
  43.         UBYTE           Flags;
  44.         Object         *HorizGad;
  45.         Object         *VertGad;
  46.         Object         *LeftGad;
  47.         Object         *RightGad;
  48.         Object         *UpGad;
  49.         Object         *DownGad;
  50.         Object         *SizeImg;
  51.         Object         *LeftImg;
  52.         Object         *RightImg;
  53.         Object         *UpImg;
  54.         Object         *DownImg;
  55. };
  56.  
  57. #define IM(o) ((struct Image *)o)
  58. #define GAD(o) ((struct Gadget *)o)
  59.  
  60. #define MAX(x,y) ((x) > (y) ? (x) : (y))
  61. #define MIN(x,y) ((x) < (y) ? (x) : (y))
  62.  
  63. static int SysISize( struct IE_Data * );
  64. ///
  65.  
  66.  
  67. /*  Support function            */
  68. /// SysISize
  69. int SysISize( struct IE_Data *IE )
  70. {
  71.     return(( IE->ScreenData->Screen->Flags & SCREENHIRES ) ?
  72.              SYSISIZE_MEDRES : SYSISIZE_LOWRES );
  73. }
  74. ///
  75.  
  76.  
  77. /*  Starting function           */
  78. /// IEX_Mount
  79. __geta4 ULONG IEX_Mount( __A0 struct IE_Data *IE )
  80. {
  81.     BPTR                    DescFile;
  82.     struct FileInfoBlock   *fib;
  83.     ULONG                   ret = IEX_ERROR_NO_DESC_FILE;
  84.     static UBYTE            FileName[] = "PROGDIR:Expanders/ScrollerWindow.desc";
  85.  
  86.     Forbid();   /* we're going to write to a GLOBAL variable */
  87.  
  88.     if( Desc ) {            /* already mounted? */
  89.         Permit();
  90.         return( IEX_OK );
  91.     }
  92.  
  93.     LibBase->Kind      = IEX_OBJECT_KIND;
  94.  
  95.     LibBase->Resizable = FALSE;
  96.     LibBase->Movable   = FALSE;
  97.     LibBase->HasItems  = FALSE;
  98.     LibBase->UseFonts  = FALSE;
  99.  
  100.     LibBase->Node.ln_Name = "SCROLLER WINDOW";
  101.  
  102.     if( fib = AllocDosObject( DOS_FIB, NULL )) {
  103.         if( DescFile = Lock( FileName, ACCESS_READ )) {
  104.  
  105.             Examine( DescFile, fib );
  106.             UnLock( DescFile );
  107.  
  108.             if( Desc = AllocVec( fib->fib_Size, 0L )) {
  109.                 if( DescFile = Open( FileName, MODE_OLDFILE )) {
  110.  
  111.                     Read( DescFile, Desc, fib->fib_Size );
  112.                     Close( DescFile );
  113.  
  114.                     ( *IE->IEXFun->SplitLines )( Desc ); // VERY important!
  115.  
  116.                     STRPTR pri;
  117.  
  118.                     pri = ( *IE->IEXFun->GetFirstLine )( Desc, "RENDPRI" );
  119.  
  120.                     if( pri )
  121.                         LibBase->Node.ln_Pri = atoi( pri );
  122.                     else
  123.                         LibBase->Node.ln_Pri = 0;
  124.  
  125.                     ret = IEX_OK;
  126.  
  127.                 } else {
  128.                     FreeVec( Desc );
  129.                     Desc = NULL;
  130.                 }
  131.             }
  132.  
  133.         }
  134.  
  135.         FreeDosObject( DOS_FIB, fib );
  136.     }
  137.  
  138.     Permit();
  139.  
  140.     return( ret );
  141. }
  142. ///
  143.  
  144.  
  145. /*  Edit functions              */
  146. /// IEX_Add
  147. __geta4 BOOL IEX_Add( __D0 UWORD ID, __A0 struct IE_Data *IE, __D1 WORD x, __D2 WORD y, __D3 UWORD width, __D4 UWORD height )
  148. {
  149.     struct ObjInfo *Obj;
  150.     BOOL            ret = FALSE;
  151.  
  152.     for( Obj = IE->win_info->wi_Gadgets.mlh_Head; Obj->Node.ln_Succ; Obj = Obj->Node.ln_Succ )
  153.         if( Obj->Kind == ID ) {
  154.             Remove(( struct Node * )Obj );
  155.             FreeMem( Obj, sizeof( struct ObjInfo ));
  156.             return( TRUE );
  157.         }
  158.  
  159.     if( Obj = AllocMem( sizeof( struct ObjInfo ), MEMF_CLEAR )) {
  160.  
  161.         Obj->Kind   = ID;       /* DON'T FORGET!!! */
  162.  
  163.         /* add our object to the list */
  164.         AddTail((struct List *)&IE->win_info->wi_Gadgets, (struct Node *)Obj );
  165.  
  166.         IE->win_info->wi_NumObjects += 1;
  167.  
  168.         /* set the right values */
  169.         IE->win_info->wi_Flags |= WFLG_SIZEGADGET;
  170.         IE->win_info->wi_IDCMP |= ( IDCMP_NEWSIZE | IDCMP_SIZEVERIFY | IDCMP_IDCMPUPDATE );
  171.         IE->win_info->wi_MaxWidth  = 0;
  172.         IE->win_info->wi_MaxHeight = 0;
  173.  
  174.         ret = TRUE;
  175.     }
  176.  
  177.     return( ret );
  178. }
  179. ///
  180. /// IEX_Remove
  181. __geta4 void IEX_Remove( __D0 UWORD ID, __A0 struct IE_Data *IE )
  182. {
  183.     struct ObjInfo   *Obj;
  184.  
  185.     IEX_Free( ID, IE );     /* make sure to release all memory */
  186.  
  187.     for( Obj = IE->win_info->wi_Gadgets.mlh_Head; Obj->Node.ln_Succ; Obj = Obj->Node.ln_Succ ) {
  188.         if(( Obj->Kind == ID ) && ( Obj->Flags & G_ATTIVO )) {
  189.  
  190.             Remove(( struct Node * )Obj );
  191.             IE->win_info->wi_NumObjects -= 1;
  192.             FreeMem( Obj, sizeof( struct ObjInfo ));
  193.  
  194.             return;
  195.         }
  196.     }
  197. }
  198. ///
  199. /// IEX_Edit
  200. __geta4 BOOL IEX_Edit( __D0 UWORD ID, __A0 struct IE_Data *IE )
  201. {
  202.     return( FALSE );
  203. }
  204. ///
  205. /// IEX_Copy
  206. __geta4 BOOL IEX_Copy( __D0 UWORD ID, __A0 struct IE_Data *IE, __D1 WORD offx, __D2 WORD offy )
  207. {
  208.     return( TRUE );
  209. }
  210. ///
  211. /// IEX_Make
  212. __geta4 struct Gadget *IEX_Make( __D0 UWORD ID, __A0 struct IE_Data *IE, __A1 struct Gadget *glist )
  213. {
  214.     struct ObjInfo     *Obj;
  215.     struct DrawInfo    *dri;
  216.  
  217.     if(!( dri = GetScreenDrawInfo( IE->ScreenData->Screen ))) {
  218.         DisplayBeep( IE->ScreenData->Screen );
  219.         return( glist );
  220.     }
  221.  
  222.     for( Obj = IE->win_info->wi_Gadgets.mlh_Head; Obj->Node.ln_Succ; Obj = Obj->Node.ln_Succ ) {
  223.         if( Obj->Kind == ID ) {
  224.  
  225.             if(!( Obj->SizeImg = NewObject( NULL, SYSICLASS,
  226.                                           SYSIA_DrawInfo, dri,
  227.                                           SYSIA_Which, SIZEIMAGE,
  228.                                           SYSIA_Size, SysISize( IE ),
  229.                                           TAG_DONE )))
  230.                 goto error;
  231.  
  232.             if(!( Obj->LeftImg = NewObject( NULL, SYSICLASS,
  233.                                           SYSIA_DrawInfo, dri,
  234.                                           SYSIA_Which, LEFTIMAGE,
  235.                                           SYSIA_Size, SysISize( IE ),
  236.                                           TAG_DONE )))
  237.                 goto error;
  238.  
  239.             if(!( Obj->RightImg = NewObject( NULL, SYSICLASS,
  240.                                           SYSIA_DrawInfo, dri,
  241.                                           SYSIA_Which, RIGHTIMAGE,
  242.                                           SYSIA_Size, SysISize( IE ),
  243.                                           TAG_DONE )))
  244.                 goto error;
  245.  
  246.             if(!( Obj->UpImg = NewObject( NULL, SYSICLASS,
  247.                                           SYSIA_DrawInfo, dri,
  248.                                           SYSIA_Which, UPIMAGE,
  249.                                           SYSIA_Size, SysISize( IE ),
  250.                                           TAG_DONE )))
  251.                 goto error;
  252.  
  253.             if(!( Obj->DownImg = NewObject( NULL, SYSICLASS,
  254.                                           SYSIA_DrawInfo, dri,
  255.                                           SYSIA_Which, DOWNIMAGE,
  256.                                           SYSIA_Size, SysISize( IE ),
  257.                                           TAG_DONE )))
  258.                 goto error;
  259.  
  260.             int resolution = SysISize( IE );
  261.             WORD topborder = IE->ScreenData->YOffset + 1;
  262.             WORD w = IM( Obj->SizeImg )->Width;
  263.             WORD h = IM( Obj->SizeImg )->Height;
  264.             WORD bw = (resolution == SYSISIZE_LOWRES) ? 1 : 2;
  265.             WORD bh = (resolution == SYSISIZE_HIRES) ? 2 : 1;
  266.             WORD rw = (resolution == SYSISIZE_HIRES) ? 3 : 2;
  267.             WORD rh = (resolution == SYSISIZE_HIRES) ? 2 : 1;
  268.             WORD gw, gh;
  269.  
  270.             gh = MAX( IM( Obj->LeftImg )->Height, h );
  271.             gh = MAX( IM( Obj->RightImg )->Height, gh );
  272.             gw = MAX( IM( Obj->UpImg )->Width, w );
  273.             gw = MAX( IM( Obj->DownImg )->Width, gw );
  274.  
  275.             if(!( Obj->HorizGad = NewObject( NULL, PROPGCLASS,
  276.                                              PGA_Freedom, FREEHORIZ,
  277.                                              PGA_NewLook, TRUE,
  278.                                              PGA_Borderless, ((dri->dri_Flags & DRIF_NEWLOOK) && dri->dri_Depth |= 1),
  279.                                              GA_Left, rw + 1,
  280.                                              GA_RelBottom, bh - gh + 2,
  281.                                              GA_RelWidth, -gw - 1 - IM(Obj->LeftImg)->Width - IM(Obj->RightImg)->Width - rw - rw,
  282.                                              GA_Height, gh - bh - bh - 2,
  283.                                              GA_BottomBorder, TRUE,
  284.                                              GA_Previous, glist,
  285.                                              TAG_DONE )))
  286.                 goto error;
  287.  
  288.             if(!( Obj->VertGad = NewObject( NULL, PROPGCLASS,
  289.                                              PGA_Freedom, FREEVERT,
  290.                                              PGA_NewLook, TRUE,
  291.                                              PGA_Borderless, ((dri->dri_Flags & DRIF_NEWLOOK) && dri->dri_Depth |= 1),
  292.                                              GA_Top, topborder + rh,
  293.                                              GA_RelRight, bw - gw + 3,
  294.                                              GA_RelHeight, -topborder - h - IM(Obj->UpImg)->Height - IM(Obj->DownImg)->Height - rh - rh,
  295.                                              GA_Width, gw - bw - bw - 4,
  296.                                              GA_RightBorder, TRUE,
  297.                                              GA_Previous, Obj->HorizGad,
  298.                                              TAG_DONE )))
  299.                 goto error;
  300.  
  301.             if(!( Obj->LeftGad = NewObject( NULL, BUTTONGCLASS,
  302.                                              GA_Image, Obj->LeftImg,
  303.                                              GA_RelRight, 1 - IM(Obj->LeftImg)->Width - IM(Obj->RightImg)->Width - gw,
  304.                                              GA_RelBottom, 1 - IM(Obj->LeftImg)->Height,
  305.                                              GA_BottomBorder, TRUE,
  306.                                              GA_Previous, Obj->VertGad,
  307.                                              TAG_DONE )))
  308.                 goto error;
  309.  
  310.             if(!( Obj->RightGad = NewObject( NULL, BUTTONGCLASS,
  311.                                              GA_Image, Obj->RightImg,
  312.                                              GA_RelRight, 1 - IM(Obj->RightImg)->Width - gw,
  313.                                              GA_RelBottom, 1 - IM(Obj->RightImg)->Height,
  314.                                              GA_BottomBorder, TRUE,
  315.                                              GA_Previous, Obj->LeftGad,
  316.                                              TAG_DONE )))
  317.                 goto error;
  318.  
  319.             if(!( Obj->UpGad = NewObject( NULL, BUTTONGCLASS,
  320.                                              GA_Image, Obj->UpImg,
  321.                                              GA_RelRight, 1 - IM(Obj->UpImg)->Width,
  322.                                              GA_RelBottom, 1 - IM(Obj->UpImg)->Height - IM(Obj->DownImg)->Height - h,
  323.                                              GA_RightBorder, TRUE,
  324.                                              GA_Previous, Obj->RightGad,
  325.                                              TAG_DONE )))
  326.                 goto error;
  327.  
  328.             if(!( Obj->DownGad = NewObject( NULL, BUTTONGCLASS,
  329.                                              GA_Image, Obj->DownImg,
  330.                                              GA_RelRight, 1 - IM(Obj->DownImg)->Width,
  331.                                              GA_RelBottom, 1 - IM(Obj->DownImg)->Height - h,
  332.                                              GA_RightBorder, TRUE,
  333.                                              GA_Previous, Obj->UpGad,
  334.                                              TAG_DONE )))
  335.                 goto error;
  336.  
  337.             glist = Obj->DownGad;
  338.  
  339.             break;
  340.         }
  341.     }
  342.  
  343.     FreeScreenDrawInfo( IE->ScreenData->Screen, dri );
  344.  
  345.     return( glist );
  346.  
  347. error:
  348.  
  349.     IEX_Free( ID, IE );
  350.  
  351.     return( glist );
  352. }
  353. ///
  354. /// IEX_Free
  355. __geta4 void IEX_Free( __D0 UWORD ID, __A0 struct IE_Data *IE )
  356. {
  357.     struct ObjInfo *Obj;
  358.  
  359.     for( Obj = IE->win_info->wi_Gadgets.mlh_Head; Obj->Node.ln_Succ; Obj = Obj->Node.ln_Succ )
  360.         if( Obj->Kind == ID ) {
  361.  
  362.             DisposeObject( Obj->HorizGad );
  363.             DisposeObject( Obj->VertGad );
  364.             DisposeObject( Obj->UpGad );
  365.             DisposeObject( Obj->DownGad );
  366.             DisposeObject( Obj->LeftGad );
  367.             DisposeObject( Obj->RightGad );
  368.  
  369.             DisposeObject( Obj->SizeImg );
  370.             DisposeObject( Obj->UpImg );
  371.             DisposeObject( Obj->DownImg );
  372.             DisposeObject( Obj->LeftImg );
  373.             DisposeObject( Obj->RightImg );
  374.  
  375.             Obj->HorizGad = NULL;
  376.             Obj->VertGad = NULL;
  377.             Obj->UpGad = NULL;
  378.             Obj->DownGad = NULL;
  379.             Obj->LeftGad = NULL;
  380.             Obj->RightGad = NULL;
  381.  
  382.             Obj->SizeImg = NULL;
  383.             Obj->UpImg = NULL;
  384.             Obj->DownImg = NULL;
  385.             Obj->LeftImg = NULL;
  386.             Obj->RightImg = NULL;
  387.  
  388.             return;  /* there could be only one object of this kind */
  389.                      /* in a window */
  390.         }
  391. }
  392. ///
  393. /// IEX_Refresh
  394. __geta4 void IEX_Refresh( __D0 UWORD ID, __A0 struct IE_Data *IE )
  395. {
  396. }
  397. ///
  398.  
  399.  
  400. /*  I/O Functions               */
  401. /// IEX_Save
  402. __geta4 void IEX_Save( __D0 UWORD ID, __A0 struct IE_Data *IE, __D1 BPTR File )
  403. {
  404. }
  405. ///
  406. /// IEX_Load
  407. __geta4 BOOL IEX_Load( __D0 UWORD ID, __A0 struct IE_Data *IE, __D1 BPTR File, __D2 UWORD Num )
  408. {
  409.     struct ObjInfo   *Obj;
  410.  
  411.     if( Obj = AllocMem( sizeof( struct ObjInfo ), MEMF_CLEAR )) {
  412.  
  413.         Obj->Kind = ID;  /* VERY important!!! */
  414.  
  415.         AddTail(( struct List * )&IE->win_info->wi_Gadgets, ( struct Node * )Obj );
  416.  
  417.     } else
  418.         return( FALSE );
  419.  
  420.     return( TRUE );
  421. }
  422. ///
  423.  
  424.  
  425. /*  Source related functions    */
  426. /// IEX_StartSrcGen
  427. __geta4 STRPTR IEX_StartSrcGen( __D0 UWORD ID, __A0 struct IE_Data *IE )
  428. {
  429.     struct WindowInfo  *wnd;
  430.     struct ObjInfo     *Obj;
  431.  
  432.     for( wnd = IE->win_list.mlh_Head; wnd->wi_succ; wnd = wnd->wi_succ ) {
  433.         if( wnd->wi_NumObjects ) {
  434.             for( Obj = wnd->wi_Gadgets.mlh_Head; Obj->Node.ln_Succ; Obj = Obj->Node.ln_Succ ) {
  435.                 if( Obj->Kind == ID ) {
  436.                     wnd->wi_NeedRender = TRUE;
  437.                     wnd->wi_NoOpenWnd  = TRUE;
  438.                     break; /* next window */
  439.                 }
  440.             }
  441.         }
  442.     }
  443.  
  444.     return(( *IE->IEXFun->GetFirstLine )( Desc, "SUPPORT" ));
  445. }
  446. ///
  447. /// IEX_WriteGlobals
  448. __geta4 void IEX_WriteGlobals( __D0 UWORD ID, __A0 struct GenFiles *Files, __A1 struct IE_Data *IE )
  449. {
  450.     STRPTR string;
  451.  
  452.     if( string = ( *IE->IEXFun->GetFirstLine )( Desc, "GLOBAL" ))
  453.         FPuts( Files->Std, string );
  454. }
  455. ///
  456. /// IEX_WriteSetup
  457. __geta4 void IEX_WriteSetup( __D0 UWORD ID, __A0 struct GenFiles *Files, __A1 struct IE_Data *IE )
  458. {
  459.     STRPTR string;
  460.  
  461.     if( string = ( *IE->IEXFun->GetFirstLine )( Desc, "SETUP" ))
  462.         FPuts( Files->Std, string );
  463. }
  464. ///
  465. /// IEX_WriteCloseDown
  466. __geta4 void IEX_WriteCloseDown( __D0 UWORD ID, __A0 struct GenFiles *Files, __A1 struct IE_Data *IE )
  467. {
  468.     STRPTR string;
  469.  
  470.     if( string = ( *IE->IEXFun->GetFirstLine )( Desc, "CLOSEDOWN" ))
  471.         FPuts( Files->Std, string );
  472. }
  473. ///
  474. /// IEX_WriteHeaders
  475. __geta4 void IEX_WriteHeaders( __D0 UWORD ID, __A0 struct GenFiles *Files, __A1 struct IE_Data *IE )
  476. {
  477.     STRPTR string;
  478.  
  479.     if( string = ( *IE->IEXFun->GetFirstLine )( Desc, "HEADER" ))
  480.         FPuts( Files->XDef, string );
  481.  
  482.     if( string = ( *IE->IEXFun->GetFirstLine )( Desc, "INCLUDE" ))
  483.         FPuts( Files->Std, string );
  484. }
  485. ///
  486. /// IEX_WriteRender
  487. __geta4 void IEX_WriteRender( __D0 UWORD ID, __A0 struct GenFiles *Files, __A1 struct IE_Data *IE )
  488. {
  489.     struct Descriptor   Dsc[] = {
  490.         { 'w', IE->win_info->wi_Label },
  491.         { 0, NULL }
  492.     };
  493.     struct ObjInfo     *Obj;
  494.     STRPTR              String;
  495.  
  496.     if( IE->win_info->wi_NumObjects ) {
  497.         if( String = ( *IE->IEXFun->GetFirstLine )( Desc, "RENDER" )) {
  498.  
  499.             for( Obj = IE->win_info->wi_Gadgets.mlh_Head; Obj->Node.ln_Succ; Obj = Obj->Node.ln_Succ ) {
  500.                 if( Obj->Kind == ID ) {
  501.  
  502.                     ( *IE->IEXFun->WriteFormatted )( Files->Std, String, &Dsc[0] );
  503.  
  504.                     return;
  505.                 }
  506.             }
  507.         }
  508.     }
  509. }
  510. ///
  511. /// IEX_GetIDCMP
  512. __geta4 ULONG IEX_GetIDCMP( __D0 UWORD ID, __D1 ULONG idcmp, __A0 struct IE_Data *IE )
  513. {
  514.     return( idcmp );
  515. }
  516. ///
  517. /// IEX_WriteData
  518. __geta4 void IEX_WriteData( __D0 UWORD ID, __A0 struct GenFiles *Files, __A1 struct IE_Data *IE )
  519. {
  520.     struct Descriptor   Dsc[] = {
  521.         { 'w', NULL },
  522.         { 0, NULL }
  523.     };
  524.     struct ObjInfo     *Obj;
  525.     struct WindowInfo  *wnd;
  526.     STRPTR              String;
  527.  
  528.     if( String = ( *IE->IEXFun->GetFirstLine )( Desc, "DATA" )) {
  529.         for( wnd = IE->win_list.mlh_Head; wnd->wi_succ; wnd = wnd->wi_succ ) {
  530.             if( wnd->wi_NumObjects ) {
  531.                 for( Obj = wnd->wi_Gadgets.mlh_Head; Obj->Node.ln_Succ; Obj = Obj->Node.ln_Succ ) {
  532.                     if( Obj->Kind == ID ) {
  533.  
  534.                         Dsc[0].Meaning = wnd->wi_Label;
  535.  
  536.                         ( *IE->IEXFun->WriteFormatted )( Files->Std, String, &Dsc[0] );
  537.  
  538.                         break;
  539.                     }
  540.                 }
  541.             }
  542.         }
  543.     }
  544. }
  545. ///
  546. /// IEX_WriteChipData
  547. __geta4 void IEX_WriteChipData( __D0 UWORD ID, __A0 struct GenFiles *Files, __A1 struct IE_Data *IE )
  548. {
  549. }
  550. ///
  551. /// IEX_WriteOpenWnd
  552. __geta4 void IEX_WriteOpenWnd( __D0 UWORD ID, __A0 struct GenFiles *Files, __A1 struct IE_Data *IE )
  553. {
  554.     struct Descriptor   Dsc[] = {
  555.         { 'w', IE->win_info->wi_Label },
  556.         { 0, NULL }
  557.     };
  558.     struct ObjInfo     *Obj;
  559.     STRPTR              String;
  560.  
  561.     if( IE->win_info->wi_NumObjects ) {
  562.         if( String = ( *IE->IEXFun->GetFirstLine )( Desc, "OPENWND" )) {
  563.  
  564.             for( Obj = IE->win_info->wi_Gadgets.mlh_Head; Obj->Node.ln_Succ; Obj = Obj->Node.ln_Succ ) {
  565.                 if( Obj->Kind == ID ) {
  566.  
  567.                     ( *IE->IEXFun->WriteFormatted )( Files->Std, String, &Dsc[0] );
  568.  
  569.                     /*
  570.                            This expanders provides a brand new
  571.                            Open<Window Label>Window routine for
  572.                            every scroller window.
  573.  
  574.                            So far, it supports only windows with
  575.                            menus.
  576.                     */
  577.  
  578.                     if( IE->win_info->wi_NumMenus )
  579.                         if( String = ( *IE->IEXFun->GetFirstLine )( Desc, "OPENWND-MENUS" ))
  580.                             ( *IE->IEXFun->WriteFormatted )( Files->Std, String, &Dsc[0] );
  581.  
  582.                     if( String = ( *IE->IEXFun->GetFirstLine )( Desc, "OPENWND-2" ))
  583.                         ( *IE->IEXFun->WriteFormatted )( Files->Std, String, &Dsc[0] );
  584.  
  585.                     if( IE->win_info->wi_NumMenus )
  586.                         if( String = ( *IE->IEXFun->GetFirstLine )( Desc, "OPENWND-MENUS-2" ))
  587.                             ( *IE->IEXFun->WriteFormatted )( Files->Std, String, &Dsc[0] );
  588.  
  589.                     if( String = ( *IE->IEXFun->GetFirstLine )( Desc, "OPENWND-END" ))
  590.                         ( *IE->IEXFun->WriteFormatted )( Files->Std, String, &Dsc[0] );
  591.  
  592.                     if( String = ( *IE->IEXFun->GetFirstLine )( Desc, "EXTERN" ))
  593.                         ( *IE->IEXFun->WriteFormatted )( Files->XDef, String, &Dsc[0] );
  594.  
  595.                     return;
  596.                 }
  597.             }
  598.         }
  599.     }
  600. }
  601. ///
  602. /// IEX_WriteCloseWnd
  603. __geta4 void IEX_WriteCloseWnd( __D0 UWORD ID, __A0 struct GenFiles *Files, __A1 struct IE_Data *IE )
  604. {
  605.     struct Descriptor   Dsc[] = {
  606.         { 'w', IE->win_info->wi_Label },
  607.         { 0, NULL }
  608.     };
  609.     struct ObjInfo     *Obj;
  610.     STRPTR              String;
  611.  
  612.     if( IE->win_info->wi_NumObjects ) {
  613.         if( String = ( *IE->IEXFun->GetFirstLine )( Desc, "CLOSEWND" )) {
  614.  
  615.             for( Obj = IE->win_info->wi_Gadgets.mlh_Head; Obj->Node.ln_Succ; Obj = Obj->Node.ln_Succ ) {
  616.                 if( Obj->Kind == ID ) {
  617.  
  618.                     ( *IE->IEXFun->WriteFormatted )( Files->Std, String, &Dsc[0] );
  619.  
  620.                     return;
  621.                 }
  622.             }
  623.         }
  624.     }
  625. }
  626. ///
  627.